<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="order/include :: header"></head>

<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
					    <div class="columns pull-right" role="group">
							<button class="btn btn-success" id="daYin" onclick="daY()">
								<i class="fa fa-print" aria-hidden="true"></i>打印
							</button>
						</div>
						<div class="form-horizontal m-t">
							<table class="table table-bordered table-condensed">
								<thead>
								    <tr>
										<th colspan="3">清单明细</th>
										<th th:text="'配送日期: ' + ${#dates.format(distributionDate,'yyyy-MM-dd')}" style="width: 18%"></th>
									</tr>
									<tr>
										<th>商品名称</th>
										<th>规格</th>
										<th>单价</th>
										<th>数量</th>
									</tr>
								</thead>
								<tbody>
									<tr th:each="item:${lineDetail.nodirectRecords}">
										<td th:text="${item.productName}"></td>
										<td th:text="${item.specTitle}"></td>
										<td th:text="${item.mprice}"></td>
										<td th:text="${item.factNum}"></td>
									</tr>
									<tr>
										<td colspan="3">合计</td>
										<td th:text="${lineDetail.totalNum}"></td>
									</tr>
									<tr>
										<td colspan="4">司机签收 : </td>
									</tr>
								</tbody>
							</table>
							<table>

							</table>
							<div class="ibox-title">
								<h5>门店清单明细</h5>
							</div>
							<table class="table table-bordered table-condensed"  th:each="item:${lineDetail.comDetails}">
								<thead>
								    <tr>
										<th colspan="4" th:text="'门店信息: '+${item.midName}+'['+${item.mid}+'] '+${item.mAddress}+' '+${item.mobile}"></th>
									</tr>
									<tr>
										<th>商品名称</th>
										<th>规格</th>
										<th>单价</th>
										<th>数量</th>
									</tr>
								</thead>
								<tbody>
									<tr th:each="item2:${item.nodirectRecords}">
										<td th:text="${item2.productName}"></td>
										<td th:text="${item2.specTitle}"></td>
										<td th:text="${item2.marketprice}"></td>
										<td th:text="${item2.factNum}"></td>
									</tr>
									<tr>
										<td colspan="3">合计</td>
										<td th:text="${item.totalNum}"></td>
									</tr>
									<tr>
										<td colspan="4">门店签字 : </td>
									</tr>
								</tbody>
							</table>
							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<div class="btn btn-danger" onclick="closeDow()" id="gBi"><i class="fa fa-remove"></i> 关闭</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

	</div>
	<div th:include="order/include::footer"></div>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}
		
		function daY() {
			if(confirm('确认打印吗？')){
			   document.getElementById('daYin').style.display="none";//隐藏打印按钮
			   document.getElementById('gBi').style.display="none";//隐藏关闭按钮
			   window.print();//打印
			   document.getElementById('daYin').style.display="inline";//打印完后显示打印按钮
			   document.getElementById('gBi').style.display="inline";//打印完后显示关闭按钮
			}
		}

		var prefix = "/nodirectList/manage";
		
		function comSortingLine(obj) {
			var id = $('#id').val();
			var productId = obj.children[0].value;
			var paras = id + "," + productId;
		    layer.open({
		        id:'nodirectt_comSortingLine',
		        type : 2,
		        title : '线路明细',
		        maxmin : true,
		        shadeClose : false,
		        area : [ '60%', '80%' ],
		        content : prefix + '/comSortingLine/' + paras 
		    });
		}
		
		function commanderDetail(obj) {
			var id = $('#id').val();
			var productId = obj.children[0].value;
			var paras = id + "," + productId;
		    layer.open({
		        id:'nodirectt_commanderDetail',
		        type : 2,
		        title : '门店明细',
		        maxmin : true,
		        shadeClose : false,
		        area : [ '70%', '95%' ],
		        content : prefix + '/commanderDetail/' + paras 
		    });
		}
	</script>
</body>
</html>
